package ru.ifmo.entities;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.sql.Date;

/**
 * User: Andrew
 * Date: 27-Jun-2010
 * Time: 14:46:57
 */
@javax.persistence.Table(name = "FLIGHTS", schema = "NAMIR")
@Entity
public class FlightsEntity {
    private int flightId;

    @javax.persistence.Column(name = "FLIGHT_ID")
    @Id
    public int getFlightId() {
        return flightId;
    }

    public void setFlightId(int flightId) {
        this.flightId = flightId;
    }

    private String name;

    @javax.persistence.Column(name = "NAME")
    @Basic
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private int cityFrom;

    @javax.persistence.Column(name = "CITY_FROM")
    @Basic
    public int getCityFrom() {
        return cityFrom;
    }

    public void setCityFrom(int cityFrom) {
        this.cityFrom = cityFrom;
    }

    private int cityTo;

    @javax.persistence.Column(name = "CITY_TO")
    @Basic
    public int getCityTo() {
        return cityTo;
    }

    public void setCityTo(int cityTo) {
        this.cityTo = cityTo;
    }

    private Date departure;

    @javax.persistence.Column(name = "DEPARTURE")
    @Basic
    public Date getDeparture() {
        return departure;
    }

    public void setDeparture(Date departure) {
        this.departure = departure;
    }

    private Date arrival;

    @javax.persistence.Column(name = "ARRIVAL")
    @Basic
    public Date getArrival() {
        return arrival;
    }

    public void setArrival(Date arrival) {
        this.arrival = arrival;
    }

    private int economPlaces;

    @javax.persistence.Column(name = "ECONOM_PLACES")
    @Basic
    public int getEconomPlaces() {
        return economPlaces;
    }

    public void setEconomPlaces(int economPlaces) {
        this.economPlaces = economPlaces;
    }

    private int bussinessPlaces;

    @javax.persistence.Column(name = "BUSSINESS_PLACES")
    @Basic
    public int getBussinessPlaces() {
        return bussinessPlaces;
    }

    public void setBussinessPlaces(int bussinessPlaces) {
        this.bussinessPlaces = bussinessPlaces;
    }


    private int companyId;

    @javax.persistence.Column(name = "COMPANY_ID")
    @Basic
    public int getCompanyId() {
        return companyId;
    }

    public void setCompanyId(int companyId) {
        this.companyId = companyId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        FlightsEntity that = (FlightsEntity) o;

        if (bussinessPlaces != that.bussinessPlaces) return false;
        if (cityFrom != that.cityFrom) return false;
        if (cityTo != that.cityTo) return false;
        if (economPlaces != that.economPlaces) return false;
        if (flightId != that.flightId) return false;
        if (arrival != null ? !arrival.equals(that.arrival) : that.arrival != null) return false;
        if (departure != null ? !departure.equals(that.departure) : that.departure != null) return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = flightId;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + cityFrom;
        result = 31 * result + cityTo;
        result = 31 * result + (departure != null ? departure.hashCode() : 0);
        result = 31 * result + (arrival != null ? arrival.hashCode() : 0);
        result = 31 * result + economPlaces;
        result = 31 * result + bussinessPlaces;
        return result;
    }
}
